{layout name="layout" /}

<div class="Hui-article">
    <article class="cl pd-20">
        <div class="cl pd-5 bg-1 bk-gray">
            <span class="l">
                <a href="{:url('/file_manager/upload')}" class="btn btn-primary radius">
                    <i class="Hui-iconfont">&#xe600;</i> 添加图片</a>
            </span>
            <span class="r">共有：
                <strong>{$counts}</strong> 个对象</span>
        </div>
        <table class="table table-border table-bordered table-bg">
            <thead>
                <tr class="text-c">
                    <th width="25%" background="/static/admin/images/linebg.gif">
                        <strong>文件名</strong>
                    </th>
                    <th width="16%" background="/static/admin/images/linebg.gif">
                        <strong>文件大小</strong>
                    </th>
                    <th width="22%" background="/static/admin/images/linebg.gif">
                        <strong>最后修改时间</strong>
                    </th>
                    <th width="34%" background="/static/admin/images/linebg.gif">
                        <strong>操作</strong>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
                    <td>
                        <a href="/file_manager/index.html?activepath={$activeurl}">
                            <img src=/static/admin/images/dir2.gif border=0 width=16 height=16 align=absmiddle> 上级目录</a>
                    </td>
                    <td>当前目录:
                        <span style="color:#f00;"> ./uploads{$activepath} </span> 　</td>
                    <td></td>
                    <td></td>
                </tr>
                {foreach $dirs as $dir}
                <tr class="text-c" style="height:26px; " onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
                    <td style="text-align:left;">
                        <a href="/file_manager/index.html?activepath={$activepath.'/'.$dir}">
                            <img src=/static/admin/images/dir.gif border=0 width=16 height=16 align=absmiddle>{$dir}
                        </a>
                    </td>
                    <td>　</td>
                    <td>　</td>
                    <td>
                        <a href="javascript:; " class="btn">改名</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:void(0);" class="btn" onclick="del_dir(this, '{$activepath}','{$dir}')">删除</a>
                    </td>
                </tr>
                {/foreach} {foreach $files as $file}
                <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
                    <td style="text-align:left;">
                        <a href="/uploads{$activepath.'/'.$file['name']}" target="_blank">
                            <img src="/static/admin/images/{$file['extension']}.gif" border=0 width=16 height=16 align=absmiddle>{$file['name']}
                        </a>
                    </td>
                    </td>
                    <td align='center'> {$file['size']} </td>
                    <td align='center'> {$file['time']} </td>
                    <td>
                        <a href='javascript:void(0);' onclick="layer_show('查看图片','/{$activepath.'/'.$file.name}','600','400')" class="btn">查看</a>&nbsp;
                        <a href='' class="btn">改名</a>&nbsp;
                        <a href='javascript:void(0);' class="btn" onclick="del(this,'{$activepath}','{$file.name}')">删除</a>&nbsp;
                        <!-- <a href='' class="btn" >移动</a>    -->
                    </td>
                </tr>
                {/foreach}
            </tbody>
        </table>
    </article>
</div>


<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    del_dir
    /*删除图片*/
    function del_dir(obj, activepath, dir) {
        layer.confirm('确认要删除吗？', function (index) {
            $.post('deldir', {
                'activepath': activepath,
                'dir': dir
            }, function (data) {
                if (data.status == 2) {
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    });
                    $(obj).parents('tr').remove();
                } else {
                    layer.msg(data.msg, {
                        icon: 5,
                        time: 1000
                    });
                    return false;
                }
            }, 'json');
        });
    }

    /*删除图片*/
    function del(obj, activepath, filename) {
        layer.confirm('确认要删除吗？', function (index) {
            $.post('del', {
                'activepath': activepath,
                'filename': filename
            }, function (data) {
                if (data.status == 1) {
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    });
                    $(obj).parents('tr').remove();
                } else {
                    layer.msg(data.msg, {
                        icon: 5,
                        time: 1000
                    });
                    return false;
                }
            }, 'json');
        });
    }
</script>
<!--请在上方写此页面业务相关的脚本-->